package cn.gcBlock.rest;

import cn.gcBlock.dto.NodeDTO;
import cn.gcBlock.dto.NodeQueryCriteria;
import cn.vo.BlockVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;


/**
 * @Author：dapan
 * @Description:cadota
 * @Date:Create in 17:39 2018/5/5
 * @Modifird By:
 */
@Api(tags = "区块签名转发模块（共识维持机制）")
@FeignClient(contextId = "restBlockService", name = "restBlockService",
        url = "${rpc.block.url}"
)
public interface RestBlockService {

    @ApiOperation(value = "发送签名账单")
    @PostMapping(name = "发送签名账单", value = "/transfer/accounts")
    ResponseEntity transfer(@RequestBody NodeDTO resource);

    /**
     * 获取余额，及钱包状态
     */
    @ApiOperation(value = "获取区块余额")
    @GetMapping(name = "获取区块余额", value = "/remain")
    ResponseEntity<BlockVo> getBlockAddressInfo(@RequestParam(value = "publicKey") String publicKey);

    /**
     * 获取余额，及钱包状态
     */
    @ApiOperation(value = "获取服务区块")
    @GetMapping(name = "获取服务区块", value = "/servers")
    ResponseEntity servers(@SpringQueryMap NodeQueryCriteria criteria, @SpringQueryMap Pageable pageable);

    /**
     * 获取区块详情
     */
    @ApiOperation(value = "获取区块信息")
    @GetMapping(name = "获取区块信息", value = "/info")
    ResponseEntity getBlockAddressInfo(@SpringQueryMap NodeQueryCriteria criteria);

    @ApiOperation(value = "查询区块列表")
    @GetMapping(value = "/list")
    ResponseEntity getBlockNodes(@SpringQueryMap NodeQueryCriteria criteria, @SpringQueryMap Pageable pageable);

    @ApiOperation(value = "查询币种列表")
    @GetMapping(value = "/symbols")
    ResponseEntity getSymbols();
}
